package com.my.zl.console.controller.autocode;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.my.zl.common.dto.ReqDTO;
import com.my.zl.common.dto.ResDTO;
import com.my.zl.common.dto.advancedQuery.PageQueryDTO;
import com.my.zl.console.common.aop.LogAnnotation;
import com.my.zl.console.controller.base.BaseController;
import com.my.zl.console.entity.autocode.ZlFieldMappingDtl;
import com.my.zl.console.dto.autocode.fieldMappingDtl.ReqFieldMappingDtlAddDTO;
import com.my.zl.console.dto.autocode.fieldMappingDtl.ReqFieldMappingDtlDelDTO;
import com.my.zl.console.dto.autocode.fieldMappingDtl.ReqFieldMappingDtlEditDTO;
import com.my.zl.console.dto.autocode.fieldMappingDtl.ReqFieldMappingDtlQueryDTO;
import com.my.zl.console.dto.autocode.fieldMappingDtl.ReqFieldMappingDtlDetailDTO;
import com.my.zl.console.dto.autocode.fieldMappingDtl.ReqFieldMappingDtlStateDTO;
import com.my.zl.console.dto.autocode.fieldMappingDtl.ResFieldMappingDtlAddDTO;
import com.my.zl.console.dto.autocode.fieldMappingDtl.ResFieldMappingDtlDelDTO;
import com.my.zl.console.dto.autocode.fieldMappingDtl.ResFieldMappingDtlEditDTO;
import com.my.zl.console.dto.autocode.fieldMappingDtl.ResFieldMappingDtlQueryDTO;
import com.my.zl.console.dto.autocode.fieldMappingDtl.ResFieldMappingDtlDetailDTO;
import com.my.zl.console.service.autocode.IFieldMappingDtlService;
import com.my.zl.console.dto.autocode.fieldMappingDtl.ResFieldMappingDtlStateDTO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 字段映射明细
 * @author ZL
 */
@Api(value="字段映射明细",tags ="字段映射明细")
@RestController
@RequestMapping("/api/autocode/fieldMappingDtl")
public class FieldMappingDtlController extends BaseController {

    @Autowired
    private IFieldMappingDtlService fieldMappingDtlService;
    
    /**
     * 查询
     */
    @ApiOperation(value="字段映射明细-查询")
    @RequestMapping(value="/list", method = RequestMethod.GET)
    public ResDTO<ResFieldMappingDtlQueryDTO> listFieldMappingDtl(ReqFieldMappingDtlQueryDTO reqInfo,PageQueryDTO page) throws Exception{
        ResFieldMappingDtlQueryDTO data = fieldMappingDtlService.queryFieldMappingDtlList(reqInfo,page);
        return successDATA(data);
    }
    
   /**
     * 详情
     */
    @ApiOperation(value="字段映射明细-详情")
    @RequestMapping(value="/detail", method = RequestMethod.GET)
    public ResDTO<ResFieldMappingDtlDetailDTO> detailFieldMappingDtl(ReqFieldMappingDtlDetailDTO reqInfo) throws Exception{
        ResFieldMappingDtlDetailDTO data = fieldMappingDtlService.queryFieldMappingDtlDetail(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 新增
     */
    @ApiOperation(value="字段映射明细-新增")
    @RequestMapping(value="/add", method = RequestMethod.POST)
    public ResDTO<ResFieldMappingDtlAddDTO> addFieldMappingDtl(@RequestBody ReqDTO<ReqFieldMappingDtlAddDTO> reqInfo) throws Exception{
        ResFieldMappingDtlAddDTO data = fieldMappingDtlService.insertFieldMappingDtlInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 编辑
     */
    @ApiOperation(value="字段映射明细-编辑")
    @RequestMapping(value="/edit", method = RequestMethod.POST)
    public ResDTO<ResFieldMappingDtlEditDTO> editFieldMappingDtl(@RequestBody ReqDTO<ReqFieldMappingDtlEditDTO> reqInfo) throws Exception{
        ResFieldMappingDtlEditDTO data = fieldMappingDtlService.updateFieldMappingDtlInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 删除
     */
    @ApiOperation(value="字段映射明细-删除")
    @RequestMapping(value="/del", method = RequestMethod.POST)
    public ResDTO<ResFieldMappingDtlDelDTO> delFieldMappingDtl(@RequestBody ReqDTO<ReqFieldMappingDtlDelDTO> reqInfo) throws Exception{
        ResFieldMappingDtlDelDTO data = fieldMappingDtlService.deleteFieldMappingDtlInfo(reqInfo);
        return successDATA(data); 
    }
    
    /**
     * 状态更新
     */
    @ApiOperation(value="字段映射明细-状态更新")
    @RequestMapping(value="/state", method = RequestMethod.POST)
    public ResDTO<ResFieldMappingDtlStateDTO> stateFieldMappingDtl(@RequestBody ReqDTO<ReqFieldMappingDtlStateDTO> reqInfo) throws Exception{
        ResFieldMappingDtlStateDTO data = fieldMappingDtlService.updateFieldMappingDtlState(reqInfo);
        return successDATA(data); 
    }
    
    
}